﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using SZSLSystem.Common;


namespace SZSLSystem.SalesManagement.Project
{
    public partial class Add : SZSLSystem.Web.UI.ManagePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr = "";           
            if (this.txtProjectName.Text.Trim() == "")
            {
                strErr += "项目名称不能为空！<br/>";
            }
            if (this.txtProjectAddress.Text.Trim() == "")
            {
                strErr += "项目地址不能为空！<br/>";
            }          

            if (strErr != "")
            {
                JscriptMsg(350, 230, "错误提示", "<b>出现错误了！</b><br/>" + strErr, "", "Error");
                return;
            }
            string OID = Guid.NewGuid().ToString();
            string ProjectName = this.txtProjectName.Text.Trim();
            string ProjectAddress = this.txtProjectAddress.Text.Trim();
            string BuildCompany = this.txtBuildCompany.Text.Trim();
            string DesignCompany = this.txtDesignCompany.Text.Trim();
            string ConstructionCompany = this.txtConstructionCompany.Text.Trim();
            string MarketingTel = this.txtMarketingTel.Text.Trim();
            string MarketingCompany = this.txtMarketingCompany.Text.Trim();
            string QualitativeInspectCompany = this.txtQualitativeInspectCompany.Text.Trim();
            string PropertyManagement = this.txtPropertyManagement.Text.Trim();

            SZSLSystem.Model.Project model = new SZSLSystem.Model.Project();
            model.OID = OID;
            model.ProjectName = ProjectName;
            model.ProjectAddress = ProjectAddress;
            model.BuildCompany = BuildCompany;
            model.DesignCompany = DesignCompany;
            model.ConstructionCompany = ConstructionCompany;
            model.MarketingTel = MarketingTel;
            model.MarketingCompany = MarketingCompany;
            model.QualitativeInspectCompany = QualitativeInspectCompany;
            model.PropertyManagement = PropertyManagement;

            SZSLSystem.BLL.Project bll = new SZSLSystem.BLL.Project();
            bll.Add(model);

            JscriptPrint("项目添加成功！", "List.aspx", "Success");
        }

    }
}
